package com.heima.kafka.service;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.entity.Person;
import com.heima.kafka.entity.Student;
import lombok.extern.slf4j.Slf4j;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Service;

import javax.xml.ws.Response;

/**
 * @Description TODO
 * @Author bo.li
 * @Date 2022/11/13 14:43
 * @Version 1.0
 */
@Service
@Slf4j
public class MessageService {

    @KafkaListener(topics = {"order-create"})
    public void onMessage(String message){
        Person student = JSON.parseObject(message, Person.class);
        log.info("收到消息:{}",student);
    }
}